package com.example.chinesechess.misc;

public class Position {
	
	//red territory is   0 <= y <= 4
	//black territory is 5 <= y <= 9
	public static int MINIMUM_X = 0;
	public static int MAXIMUM_X = 8;
	public static int MINIMUM_Y = 0;
	public static int MAXIMUM_Y = 9;
	
	public int x;
	public int y;
	
	public Position (int x1, int y1) {
		x = x1;
		y = y1;
	}
	public boolean isTerritory(PlayerEnum player) {
		switch(player) {
			case RED:
				return 0<=y && y<=4; 
			case BLACK:
				return 5<=y && y<=9;
			default:
				return false;
		}
	}
	public boolean isPalace(PlayerEnum player) {
		switch(player) {
			case RED:
				return 0<=y && y<=2 && 3<=x && x<=5;
			case BLACK:
				return 7<=y && y<=9 && 3<=x && x<=5;
			default:
				return false;
		}
	}
	
	public String toString() {
		return x+","+y;
	}
}
